<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="weixin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>个人信息</title>
    <link rel="stylesheet" href="../../static/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="../../static/lib/bootstrapValidator/css/bootstrapValidator.min.css"/>
</head>
<body style="background-color: #4cae4c">
<div class="container">
    <div class="text-center">
        <h3>个人信息</h3>
    </div>
    <div>
        <form method="post" action="/weixin/login">
            <input type="hidden" name="wxid" th:value="${wxid}">
            <div class="form-group">
                <label for="email">邮箱</label>
                <input type="email" class="form-control" id="email" name="email" placeholder="jane.doe@example.com">
            </div>
            <div class="text-center" style="margin-top: 3.125rem;">
                <button type="button" id="submit" class="btn btn-primary" style="width: 100%;">登录</button>
            </div>
        </form>
    </div>
    <div>
        <div id="modal01" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <strong>提示：</strong></br>
                    <p>该用户不存在！</p>
                </div>
            </div>
        </div>
        <div id="modal02" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <strong>提示：</strong></br>
                    <p>该邮箱已经被绑定，有疑问请联系管理员:4312-5321</p>
                </div>
            </div>
        </div>
        <div id="modal03" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <strong>提示：</strong></br>
                    <p>该邮箱存在违法违规行为已被锁定，暂时无法登陆</p>
                </div>
            </div>
        </div>
    </div>
</div>
<!--/*/<th:block th:replace="weixin/_fragments :: script">/*/-->
<script src="../../static/jquery/jquery-3.4.1.min.js" type="text/javascript"></script>
<script src="../../static/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../../static/lib/bootstrapValidator/js/bootstrapValidator.min.js" type="text/javascript"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js" type="text/javascript"></script>
<!--/*/</th:block>/*/-->
<script>
    $(function() {
        /*表单验证的初始化*/
        $('form').bootstrapValidator({
            fields :{
                email: {
                    validators: {
                        notEmpty: {
                            message: '邮箱不能为空'
                        },
                        emailAddress: {
                            message: '邮箱地址格式有误'
                        },
                    }
                }
            }
        });
        var bootstrapValidator = $('form').data('bootstrapValidator');
        // 提交时验证
        $('#submit').click(function () {
            bootstrapValidator.validate();
            if (bootstrapValidator.isValid()) {
                var url = "/user/login"
                var data = $('form').serialize();
                $.post(url, data, function (msg) {
                    if (msg == "1") {
                        $("#modal01").modal("show");
                    } else if (msg == "2") {
                        $("#modal02").modal("show");
                    } else if (msg == "3") {
                        $("#modal03").modal("show");
                    } else if (msg == "4") {
                        WeixinJSBridge.call('closeWindow');
                    }
                })
            }
            return false;
        });
    });
</script>
</body>
</html>
